package com.onetech.adrewards.free.dialogs;

import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.google.analytics.tracking.android.Fields;
import com.google.analytics.tracking.android.MapBuilder;
import com.google.analytics.tracking.android.Tracker;
import com.onetech.adrewards.free.R;
import com.onetech.adrewards.free.activities.LoginInviteCodeActivity;
import com.zuzu.dialogs.BaseDialogNoTitleBar;

public class SuccessInviteCodeDialog extends BaseDialogNoTitleBar {
	private TextView newsContent=null;
	
	private Tracker mTracker;
	private LoginInviteCodeActivity mContext=null;
	public SuccessInviteCodeDialog(LoginInviteCodeActivity context,String message){
		super(context, "",
				TYPE_NO_BUTTON, R.layout.dialog_success_invite_code_layout);
		setCancelable(false);
		setCanceledOnTouchOutside(false);
		mContext=context;
		newsContent=(TextView)findViewById(R.id.successMessage);
		newsContent.setText(Html.fromHtml(message));
	}	
	@Override
    public void onStart() {
        super.onStart();
        try {
            mTracker.set(Fields.SCREEN_NAME, mContext.getString(R.string.SuccessInviteCodeDialog));            
            mTracker.send(MapBuilder.createAppView().build());            
		} catch (Exception e) {
		}
    }	
	@Override
	public void onClick(View view) {
		int id=view.getId();
		switch (id) {
		case R.id.exitDialogBtn:
			this.dismiss();
			mContext.go2HomePage();
			break;
		default:
			super.onClick(view);
			break;
		}		
	}
	
}
